import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;

public class Coin {

        public Image image;
        public int x, y;

        ArrayList<Point> points1 = new ArrayList<Point>(100);

        Rectangle rect;

        public boolean active;

        public Coin(Image image) {
                this.image = image;
                x = 800;
                y = (int) (Math.random() * (320 - image.getHeight(null)));

                rect = new Rectangle(image.getWidth(null), image.getHeight(null));

        }

        public void render(Graphics g) {

                if (active) {
                        g.drawImage(image, x, y, null);
                }

        }

        public void update() {

                x = x - 3;
               
                if (x < 0 - image.getWidth(null)) {
                        active = false;
                }

        }

        public Rectangle getArea() {
                rect.x = x;
                rect.y = y;
                return rect;
        }


}

